const hfModel=require('../models/hf.js')
const categoryModel=require('../models/aboutCategory.js')
const aboutModel=require('../models/about.js');
const contactModel=require('../models/contact.js')

class FrontController{

    static getIndex1=async (req, res) => {
        const info = await hfModel.findOne();
        const infos = await categoryModel.find();
        const infosArray = [];
        for (let arrt in infos) {
            infosArray.push(infos[arrt].cateName);
        }
        const details=await aboutModel.find({cateId:infos[0]._id});
        res.render('front/index1', {info: info, infosArray,details});
    };

    static getIndex9=async (req, res) => {
        const info = await hfModel.findOne();
        const cateInfo = await categoryModel.find();
        const infosArray = [];
        for (let arrt in cateInfo) {
            infosArray.push(cateInfo[arrt].cateName);
        }
        const infos=await contactModel.findOne();
        res.render('front/index9', {info: info,infosArray,infos:infos});
    };

    static getIndex10=async (req, res) => {
        const info = await hfModel.findOne();
        const infos = await categoryModel.find();
        const infosArray = [];
        for (let arrt in infos) {
            infosArray.push(infos[arrt].cateName);
        }
        const details=await aboutModel.find({cateId:infos[1]._id});
        res.render('front/index10', {info: info,infosArray,details});
    };

        static getIndex11=async (req, res) => {
            const info = await hfModel.findOne();
            const infos = await categoryModel.find();
            const infosArray = [];
            for (let arrt in infos) {
                infosArray.push(infos[arrt].cateName);
            }
            const details=await aboutModel.findOne({cateId:infos[2]._id});
            res.render('front/index11', {info: info,infosArray,details});
        };

        static getIndex14=async (req, res) => {
            const info = await hfModel.findOne();
            const infos = await categoryModel.find();
            const infosArray = [];
            for (let arrt in infos) {
                infosArray.push(infos[arrt].cateName);
            }
            const details=await aboutModel.find({cateId:infos[0]._id});
            res.render('front/index14', {info: info,infosArray,details});
        };

}

module.exports=FrontController;